from django.db import models
from order.models import Order

class Complaint(models.Model):
    content = models.TextField(
        verbose_name="投诉内容",
        max_length=256)
    phone = models.CharField(
        verbose_name="反馈电话",
        max_length=11,
        null=True,
        blank=True)
    date_time = models.DateTimeField(
        verbose_name="投诉时间",
        auto_now_add=True)
    order = models.ForeignKey(Order,
                              models.CASCADE)

    class Meta:
        db_table = "moh_complaint"
        verbose_name = "投诉表"
        verbose_name_plural = "投诉表"

    def __str__(self):
        return f"{self.content},{self.phone}"
